package models

import "gorm.io/gorm"

type Shop struct {
	gorm.Model
	Name   string  `gorm:"type:varchar(50); not null; commit: '商品名称'"`
	Num    int     `gorm:"type:int(50); not null; commit: '商品数量'"`
	Price  float64 `gorm:"type:int(50); not null; commit: '商品价钱'"`
	TypeId int     `gorm:"type:int(50); not null; commit: '商品类别'"`
}
type ShopTypeId struct {
	gorm.Model
	Name string
}
type ShopData struct {
	Shop
	Name string
}

func (s *Shop) Add() error {
	return DB.Create(&s).Error
}

func (s *Shop) List() error {
	return DB.Find(&s).Error
}

func (s *Shop) Update() error {
	return DB.Updates(&s).Error
}

func (s *Shop) Del() error {
	return DB.Delete(&s).Error
}
